package com.company.exp2.util.Recorder;

public class Recorder implements Recordable {

    public static final RecorderType defaultType = RecorderType.NONE_DELAY_RECORDER;

    private Recordable strategy;

    public Recorder() {
        this(defaultType);
    }

    public Recorder(RecorderType type) {
        switch (type) {
            case STANDARD_TIME_RECORDER:
                strategy = new StandardTimeRecorder();
                break;
            case NONE_DELAY_RECORDER:
                strategy = new NoneDelayTimeRecorder();
                break;
        }
    }

    @Override
    public void onPut() {
        strategy.onPut();
    }

    @Override
    public void onPop() {
        strategy.onPop();
    }

    @Override
    public void onPut(long timestamp) {
        strategy.onPut(timestamp);
    }

    @Override
    public void onPop(long timestamp) {
        strategy.onPop(timestamp);
    }

    @Override
    public void log() {
        strategy.log();
    }

    @Override
    public Recordable setNo(int No) {
        return strategy.setNo(No);
    }
}
